<#include "/lib/web/macro-lib.ftl"/>
<#if bookmark?exists>
  <#assign title='\''+bookmark.title+'\' saved by ' + bookmark.user.username/>
  <#assign thisPageHref = gzBookmarkUrl(bookmark.id?c)/>
</#if>
<@pageBegin pageTitle=title cssHref=[gzUrl("/css/gnizr-linkhistory.css")]>
</@pageBegin>
<@headerBlock>
</@headerBlock>
<style type="text/css">
	.comment {
		padding:3px;
		margin:2px;
	}
	.userComment {	
		border:1px solid #c0c0c0;
		padding:3px;
		margin-top:10px;
		width:81%;
	}
	.userName {
		background:#FFF3B3;
		padding:4px;
		color:#000000;
	}
	</style>
<@pageContent>
<#assign bct=communityBCT() + searchBCT() + [gzBCTPair('bookmark','')]/>
<@infoBlock bct=bct/> 
<#if bookmark?exists>
<div id="bookmark-detail">
<h2 class="title"><a target="_blank" href="${bookmark.link.url}" title="${bookmark.title}">${bookmark.title}</a></h2>
<p class="link">${bookmark.link.url}</p>
<p class="meta">Saved by <a href="${gzUserUrl(bookmark.user.username)}">${bookmark.user.username}</a> 
<#if (bookmark.tagList?size > 0)> tagged
  <#list bookmark.tagList as tag>    
    <a class="tag" href="${gzUserTagUrl(bookmark.user.username,tag)}">${tag}</a><#if tag_has_next>, </#if>
  </#list>
</#if>
</p> 
<#if bookmark.notes?exists && (bookmark.notes?length > 0)>
<div class="notes">
${bookmark.notes}
</div>
</#if>
<p class="meta">Created On: ${bookmark.createdOn} :: Last Updated: ${bookmark.lastUpdated} :: 
<#if loggedInUser?exists>
  <#if (loggedInUser.id == bookmark.user.id)>
  <a href="${gzUrl('/edtpost?url='+bookmark.link.url?url+'&redirectToPage='+thisPageHref)}" class="system-link">edit</a> :: 
  <#else>
  <a href="${gzUrl('/post?url='+bookmark.link.url?url+'&redirectToPage='+thisPageHref)}" class="system-link">save</a> :: 
  </#if>
</#if>
Comments: ${commentCount} 
</p>
</div>

<div>
<#if comments?exists && (commentCount > 0)>
<p class="meta"><b>Comments</b>:
  <#list comments as cmt>
    <#if (cmt.author.id == loggedInUser.id)>
    	<div class="userComment">
	    	<div class="userName"> <b style="color:#2d67c6;" />You</b>, at ${cmt.lastUpdated?time} on ${cmt.lastUpdated?date}, said:</div>
	      	<div class="comment">${cmt.text}</div>
      	</div>
    
    <#else>
     <div class="userComment">
	    	<div class="userName"><b><a href="${gzUserUrl(cmt.author.username)}" style="color:#2d67c6;">${cmt.author.fullname}</a></b>, at ${cmt.lastUpdated?time} on ${cmt.lastUpdated?date}, said:</div>
	      	<div class="comment">${cmt.text}</div>
     </div>
    </#if>
  </#list>
  </p>
      
</#if>
</div>

<br />

  <div id="comments" style="width:81.6%" />
		<form action="/gnizr/comment/addComment.action" name="addCommentForm" method="post">
  			<@ww.richtexteditor  labelposition="top"
				toolbarCanCollapse="false"
				cssClass="text-input-notes"
				label="Add Your Thoughts" 
				name="comment" 
				height="200"
				fontFormats="h3;h4;p"	
				fontColors="FF0000,FF8040,00FF00,FFFF00,00FFFF,800080,FF00FF,2B60DE"
				toolbarSet="MyToolbar"
				customConfigurationsPath="${gzUrl('/lib/javascript/fckeditor-config.js')}"
				value=""
			/>                 
			<input type="hidden" name="bookmarkId" value="${bookmark.id}" />
			<br />
			<div style="float:right;">
				<@ww.submit id="submitComment" cssClass="btn saveSubmit" value="Post Comment" theme="simple"/>
			</div>
			<br />
		</form>
  </div>
  
<#else>
<h3>No such bookmark.</h3>
</#if>

</@pageContent>
<@pageEnd/>



   